// 类的继承
// 定义父类
class Person {
  name: string
  age: number
  constructor(name: string, age: number) {
    this.name = name
    this.age = age
  }
  eating() {
    console.log(this.name, this.age)
  }
}

// 定义一个子类，并且继承Person这个类
class Student extends Person {
  stuId: number
  constructor(name: string, age: number, stuId: number) {
    super(name, age);
    this.stuId = stuId
  }
  studying() {
    console.log("这是一个学生实例:", this.name, this.age, this.stuId);
  }
}

function test() {
  const stu = new Student('cht', 20, 11)
  console.log(stu)
  stu.eating();
  stu.studying();
}

export {
  test
}